<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/init.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<jsp:include page="/WEB-INF/jsp/common/common.jsp" />
	<jsp:include page="/WEB-INF/jsp_lib/showimage.jsp" />
	<script type="text/javascript">
		$(function(){
			var img = "<img src='${path}/img/imgid.htm?mh=500&mw=500'/>";
			showBig(img);
		});
		function query(){
			$("#form1").submit();
		}
		function goOprate(){
		
			var seal_id = $("input[name='seal_id']").val();
			var sta = $("input[name='sta']").val();
			var user_id = $("select[name='user_id']").val();
			$.ajax({
				type:"post",
				url:"${path}/ix/seal/set/get/operate.htm",
				data:{seal_id:seal_id,sta:sta,user_id:user_id},
				success: function(data){
					location.reload();
					ohSnap("操作成功！", "success");
				}
			});			
		}
		
		function myEdit1(seal_id,sta){
			$("input[name='sta']").val(sta);
			$("input[name='seal_id']").val(seal_id);
			$("#emp").show();
		}
		
		function myEdit2(seal_id,sta){
			if(confirm("确认归还吗？")){
		
			$("input[name='sta']").val(sta);
			$("input[name='seal_id']").val(seal_id);
			goOprate();
			}
		}
		function myNo(){
			$("#emp").hide();
		}
		
	
	</script>
</head>
<body>
<jsp:include page="/WEB-INF/jsp_lib/tip.jsp" />
	<div>
		<form action="${path}/ix/seal/set/get/list.htm" id="form1" method="post">
			<input type="hidden" name="seal_id" />
			<input type="hidden" name="sta" />
			<h2>
				<div>柜员领用</div>
			</h2>
			<div class="query">
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="5">
					<tr>
						<td width="80" align="right">
							<strong>印章名称：</strong>
						</td>
						<td width="200" align="left">
							<input name="srh_name" type="text" /> 
						</td>
						<td align="left">
							<a href="javascript:query();">
								<img src="${path}/style_cp/img/query.jpg" name="Image4" width="85" height="27" border="0" id="Image4" /> 
							</a>
						</td>
					</tr>
				</table>
			</div>
			
			<table width="100%" class="listlindex">
				<tr>
					<th>印章名称</th>
					<th>印模图片</th>
					<th>印章描述</th>
					<th>印章状态 </th>
					<th>操作</th>
				</tr>
				<c:if test="${fn:length(list)==0}">
					<tr>
						<td colspan="5"><div class="tip_div">暂无记录.</div></td>
					</tr>
				</c:if>	
				<c:forEach items="${list}" var="v">					
					<tr>
						<td>${v.name} <c:if test="${fn:length(v.uname)!=0}"> 【${v.uname}】</c:if></td>
						<td><a href="${path}/img/${v.file_id}.htm" target="_blank" class="banimg" id="${v.file_id}">
							<img src='${path}/img/${v.file_id}.htm?mh=50&mw=50'/></a></td>
						<td>${v.note}</td>
						<td id="sta">${v.flag_use}<c:if test="${fn:length(v.flag_change)!=0}">	【${v.flag_change}】</c:if></td>
						<td>
						<c:if test="${v.flag_use=='未领取'}"><a href="javascript:myEdit1('${v._id}','已领取');">【领取】</a></c:if>
						<c:if test="${v.flag_use=='使用中'}"></c:if>
						<c:if test="${v.flag_use=='已领取'}"><a href="javascript:myEdit2('${v._id}','未领取');">【归还】</a>	</c:if>
						<c:if test="${v.flag_use=='待归还'}"><a href="javascript:myEdit2('${v._id}','待归还');">【待归还】</a>	</c:if>
						</td>
					</tr>
				</c:forEach>
			</table>	
			<div id="response"></div>
			<div class="options">
				<div class="quotes">
					<page:page page="${page}" />
				</div>
				<div class="clear"></div>
			</div>		
			
	<div id="emp" style="height:500px;width:300px;	position: fixed;left: 36%;top: 30%;display:none;">
		<div class="query">
				<h2>
					<div>请选择领取人</div>
				</h2>
				<table width="100%" class="listlindex">
					<tr>
						<td width="30%">领取人</td>
						<td>
						<select name="user_id">
							<c:forEach items="${userlist}" var="v">
								<option value="${v._id}">${v.uname}</option>
							</c:forEach>
						</select>
						</td>
					</tr>
				</table>	
				<div>&nbsp;</div>
				<a href="javascript:goOprate();">【确定】</a>
				<a href="javascript:myNo();">【取消】</a>
		</div>
	</div>	
		</form>	
	
	</div>
</body>
</html>